import request from "@/utils/request";
import { get } from "https";
const env = window.ENV || {
  API_USER: "",
  API_SKIN: "",
  VUE_APP_AUTH_SERVER_URL: "",
  VUE_APP_REALM: ""
};

//版本信息
export function getVersionList(url) {
  return request({
    url: url,
    method: "get"
  });
}
//皮肤接口
export function getSkinInfo(data) {
  return request({
    url: env.API_SKIN + "/BCM/skin/query",
    method: "post",
    data: data
  });
}

//获取用户
export function getUserList(query) {
  return request({
    url: env.API_USER + "/v1/users",
    method: "get",
    params: query
  });
}
//获取用户详情
export function getUserDetail(id) {
  return request({
    url: env.API_USER + `/v1/users/${id}`,
    method: "get"
  });
}
//增加用户
export function addUserInfo(data) {
  return request({
    url: env.API_USER + "/v1/users",
    method: "post",
    data: data
  });
}
//修改用户
export function updateUser(id, data) {
  return request({
    url: env.API_USER + `/v1/users/${id}`,
    method: "put",
    data: data
  });
}
//删除用户
export function deleteUserInfo(id) {
  return request({
    url: env.API_USER + `/v1/users/${id}`,
    method: "delete"
  });
}
//用户分配角色
export function addUserRole(id, query) {
  return request({
    url: env.API_USER + `/v1/users/${id}/roles/${query}`,
    method: "put"
  });
}
//查看用户所有权限
export function getUserAuthority(id) {
  return request({
    url: env.API_USER + `/v1/users/${id}/authority`,
    method: "get"
  });
}
//用户锁定、解锁 isLock: true代表锁定，false:代表解锁
export function lockHandel(id, data) {
  return request({
    url: env.API_USER + `/v1/users/${id}/lock/${data}`,
    method: "put"
  });
}
//修改用户密码
export function updatePassword(id, data) {
  return request({
    url: env.API_USER + `/v1/users/${id}/password`,
    method: "put",
    data: data
  });
}

export function addUserLogoutLog(data) {
  return request({
    url: `${env.API_USER}/addUserLogoutLog`,
    method: "post",
    data
  });
}
